import axios from './api' // 倒入 api
import config from './config.js' // 倒入默认配置
export const BASEURL = config.baseURL

/* 将所有接口统一起来便于维护
 * 如果项目很大可以将 url 独立成文件，接口分成不同的模块
 */

export const IMAGEPATH = BASEURL + 'appserver'

// 获取验证码
export const USERCAPTCHA = BASEURL + '/usercenter/captcha'

// 登录接口
export const REQUEST_LOGIN = (params) => {
  return axios({
    url: '/user/login',
    method: 'POST',
    data: params,
  })
}

// 获取医生列表
export const GET_DOCTOR_LIST = (params) => {
  return axios({
    url: '/doctor/pageQuery',
    method: 'POST',
    data: params,
  })
}

// 删除医生信息
export const DELECT_DOCTOR_INFO = (params) => {
  return axios({
    url: `/doctor/delete/${params.id}`,
    method: 'GET',
    data: {},
  })
}

// 新增医生信息
export const ADD_DOCTOR_INFO = (params) => {
  return axios({
    url: '/doctor/add',
    method: 'POST',
    data: params,
  })
}

// 编辑医生信息
export const UPDATE_DOCTOR_INFO = (params) => {
  return axios({
    url: '/doctor/update',
    method: 'POST',
    data: params,
  })
}

// 获取医生信息
export const GET_DOCTOR_INFO = (params) => {
  return axios({
    url: `/doctor/${params.id}`,
    method: 'GET',
    data: {},
  })
}

// 获取案例列表
export const GET_CASE_LIST = (params) => {
  return axios({
    url: '/case/pageQuery',
    method: 'POST',
    data: params,
  })
}

// 删除案例
export const DELETE_CASE_INFO = (params) => {
  return axios({
    url: `/case/delete/${params.id}`,
    method: 'GET',
    params: {}
  })
}

// 获取案例详情
export const GET_CASE_INFO = (params) => {
  return axios({
    url: `/case/${params.id}`,
    method: 'GET',
    params: {}
  })
}

// 新增案例信息
export const ADD_CASE_INFO = params => {
  return axios({
    url: `/case/add`,
    method: 'POST',
    data: params
  })
}

// 编辑案例信息
export const UPDATE_CASE_INFO = params => {
  return axios({
    url: `/case/update`,
    method: 'POST',
    data: params
  })
}

// 获取文章列表
export const GET_ARTICLE_LIST = params => {
  return axios({
    url: `/article/pageQuery`,
    method: 'POST',
    data: params
  })
}

// 删除文章信息
export const DELETE_ARTICLE_INFO = params => {
  return axios({
    url: `/article/delete/${params.id}`,
    method: 'GET',
    data: {}
  })
}

// 获取文章信息
export const GET_ARTICLE_INFO = params => {
  return axios({
    url: `/article/${params.id}`,
    method: 'GET',
    data: {}
  })
}

// 新增文章信息
export const ADD_ARTICLE_INFO = params => {
  return axios({
    url: `/article/add`,
    method: 'POST',
    data: params
  })
}

// 编辑文章信息
export const UPDATE_ARTICLE_INFO = params => {
  return axios({
    url: `/article/update`,
    method: 'POST',
    data: params
  })
}

//预约管理列表
export const GET_APPOINTMENT_LIST = params => {
  return axios({
    url: `/appointment/pageQuery`,
    method: 'POST',
    data: params
  })
}

//访客管理列表
export const GET_VISITOR_LIST = params => {
  return axios({
    url: `/visitor-record/pageQuery`,
    method: 'POST',
    data: params
  })
}

//访客管理列表-标记访客
export const MARK_VISITOR_INFO = params => {
  return axios({
    url: `/visitor-record/mark/${params.id}`,
    method: 'GET',
    data: {}
  })
}

//查询价格列表
export const GET_QUERY_PRICE_LIST = params => {
  return axios({
    url: `/query-price/pageQuery`,
    method: 'POST',
    data: params
  })
}

//查询价格列表-标记查询价格
export const MARK_QUERY_PRICE_INFO = params => {
  return axios({
    url: `/query-price/mark/${params.id}`,
    method: 'GET',
    data: {}
  })
}

//查询城市列表
export const GET_CITY_LIST = params => {
  return axios({
    url: `/city/pageQuery`,
    method: 'POST',
    data: params
  })
}

//根据id删除城市
export const DELETE_CITY_INFO = params => {
  return axios({
    url: `/city/delete/${params.id}`,
    method: 'GET',
    data: {}
  })
}

//新增城市信息
export const ADD_CITY_INFO = params => {
  return axios({
    url: `/city/add`,
    method: 'POST',
    data: params
  })
}

//编辑城市信息
export const UPDATE_CITY_INFO = params => {
  return axios({
    url: `/city/update`,
    method: 'POST',
    data: params
  })
}

// 获取城市信息
export const GET_CITY_INFO = params => {
  return axios({
    url: `/city/${params.id}`,
    method: 'GET',
    data: {}
  })
}

// 文件上传
export const FILE_UPLOAD_PATH = `${BASEURL}upload/fileUpload`;